package com.ticket.sass.common.wxpay;

/**
 * @author ywb
 * @date 2024-05-22 16:48
 */

import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.exception.WxPayException;

import java.math.BigDecimal;

public class WxPayClient {
    
    private final WxPayServiceWrapper wxPayServiceWrapper;
    
    public WxPayClient(String appId, String mchId, String mchKey, String p12Content) throws Exception {
        this.wxPayServiceWrapper = new WxPayServiceWrapper(appId, mchId, mchKey, p12Content);
    }
    
    public WxPayRefundResult initiateRefund(String orderNo, BigDecimal refundFee, BigDecimal totalFee, String desc, String notifyUrl) throws WxPayException {
        return wxPayServiceWrapper.refund(orderNo, refundFee, totalFee, desc, notifyUrl);
    }
    
    public WxPayRefundQueryResult checkRefundStatus(String outRefundNo) throws WxPayException {
        return wxPayServiceWrapper.queryRefund(outRefundNo);
    }
}